<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Display All</title>
<link href="./css/bootstrap.min.css" rel="stylesheet" />
<style type="text/css">
.container {
	display: flex;
	flex-flow: column;
	align-items: center;
}

caption {
	text-align: center;
}

.table {
	font-size: 18px;
}
</style>
</head>
<body>
	<div class="container">
		<table class="table table-hover table-bordered"
			style="width: 400px; height: auto;">

			<s:if test="#session['flag']=='user'">
				<caption>
					<h1>All User Info</h1>
				</caption>
				<thead>
					<tr>
						<th>编号</th>
						<th>姓名</th>
						<th>密码</th>
					</tr>
				</thead>
				<s:iterator var="newone" value="#session['all']" status="st">
					<tr>
						<td><s:property value="#newone.id" /></td>
						<td><s:property value="#newone.name" /></td>
						<td><s:property value="#newone.password" /></td>
					</tr>
				</s:iterator>
			</s:if>
			<s:if test="#session['flag']=='book'">
				<caption>
					<h1>All Book Info</h1>
				</caption>
				<thead>
					<tr>
						<th>书籍编号</th>
						<th>书籍名称</th>
						<th>操作一</th>
						<th>操作二</th>
					</tr>
				</thead>

				<s:iterator var="newone" value="#session['all']" status="st">
					<tr>
						<td><s:property value="#newone.book_id" /></td>
						<td><s:property value="#newone.book_name" /></td>
						<td>
							<s:url var="delete" value="delete.action">
						  		<s:param name="book_id" value="#newone.book_id"></s:param>
						  	</s:url>
							<s:a href="%{delete}">删除</s:a>
						</td>
						<td>
						  	<s:url var="gotoupdate" value="gotoupdate.action">
						  		<s:param name="book_id" value="#newone.book_id"></s:param>
						  	</s:url>
						  	<s:a href="%{gotoupdate}">更新</s:a>
						</td>
					</tr>
				</s:iterator>
			</s:if>
		</table>
		<!--  
		<s:url var="url_first" value="showpage.action">
			<s:param name="pagenow" value="1"></s:param>
		</s:url>
		<s:url var="url_last" value="showpage.action">
			<s:param name="pagenow" value="#session['maxpage']"></s:param>
		</s:url>
		<s:url var="url_pre" value="showpage.action">
			<s:param name="pagenow" value="pagenow-1"></s:param>
		</s:url>
		<s:url var="url_next" value="showpage.action">
			<s:param name="pagenow" value="pagenow+1"></s:param>
		</s:url>
		<ul class="pager" style="width: 400px;">
			<li><s:a href="%{url_first}">首页</s:a></li>
			<li class="previous"><s:a href="%{url_pre}">&larr;上一页</s:a></li>
			<li class="next"><s:a href="%{url_next}">下一页&rarr;</s:a></li>
			<li><s:a href="%{url_last}">末页</s:a></li>
		</ul>
		-->

	</div>

	<script type="text/javascript" src="./js/jquery-3.2.1.js"></script>
	<script type="text/javascript" src="./js/bootstrap.min.js"></script>
</body>
</html>